package com.vogue.supplymall.order.domain.service.impl;

import com.vogue.ssm.database.dao.BaseDao;
import com.vogue.supplymall.common.domain.dto.OrderDetailInfo;
import com.vogue.supplymall.common.domain.dto.SearchOrderInfo;
import com.vogue.supplymall.order.domain.dao.OrderDao;
import com.vogue.supplymall.order.domain.model.Order;
import com.vogue.supplymall.order.domain.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * The type Order service.
 *
 * @aouthor: zhangliang
 * @date: Create in 2018-01-10
 */
@Service("orderService")
public class OrderServiceImpl extends BaseServiceImpl<Order, Long> implements OrderService {

    @Resource
    private OrderDao orderDao;

    /**
     * Instantiates a new Order service.
     *
     * @param baseDao the base dao
     */
    public OrderServiceImpl(BaseDao<Order, Long> baseDao) {
        super(baseDao);
    }

    @Override
    public Order addOrder(Order order) {
        return orderDao.save(order);
    }

    @Override
    public List<Map<String, Object>> findOrderDetail(OrderDetailInfo detailInfo) {
        return orderDao.findOrderDetail(detailInfo);
    }

    @Override
    public List<Map<String, Object>> findOrderList(SearchOrderInfo searchOrderInfo) {
        return orderDao.findOrderList(searchOrderInfo);
    }

    @Override
    public List<Map<String, Object>> findOrderCount(SearchOrderInfo searchOrderInfo) {
        return orderDao.findOrderCount(searchOrderInfo);
    }

	@Override
	public void updateOrderCommentFlag(Long orderId, Long productId, int type) throws Exception{
		orderDao.updateOrderCommentFlag(orderId, productId, type);
		
	}

    @Override
    public Order getOrder(String ordernumber, Long syscodeid) {
        return orderDao.getOrder(ordernumber, syscodeid);
    }

}
